package edu.sctu.practice.class02.liqing.assignment03.assignment03_03;

/**
 * Created by 123456 on 2015/11/2.
 */
public class Test {
    public static void main(String[] args) {
        CloneableCircle c1 = new CloneableCircle(5);
        CloneableCircle c2 = (CloneableCircle)c1.clone();
        System.out.println("After copying c1 to circl2");
        if (c1 == c2)
            System.out.println("c1 and c2 reference to the same object");
        else
            System.out.println("c1 and c2 don't point to the same object");
        if (c1.equals(c2))
            System.out.println("c1 and c2 have the same contents");
        else
            System.out.println("c1 and c2 don't have the same contents");
        c1.setRadius(10);
        c1.getCreator().setFirstName("Michael");
        c1.getCreator().setMiddleName("Z");
        System.out.println("\nAfter modifying c1");
        System.out.println("c1 " + c1);
        System.out.println("c2 " + c2);

        System.out.println();
        if (c1 instanceof Cloneable)
        {
            System.out.println("A CloneableCircle objec is cloneable");
        }
        else
        {
            System.out.println("A CloneableCircle objec is not cloneable");
        }
        Circle c = new Circle(3);
        if (c instanceof Cloneable)
        {
            System.out.println("A Circle object is cloneable");
        }
        else
        {
            System.out.println("A Circle object is not cloneable");
        }
    }

    }

